# Maintainer: Martell Malone <Martell Malone at g mail dot com>

_realname=ninja
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=1.12.1
pkgrel=1
pkgdesc="Ninja is a small build system with a focus on speed (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clangarm64')
url="https://ninja-build.org"
license=('spdx:Apache-2.0')
makedepends=("re2c" "${MINGW_PACKAGE_PREFIX}-python" "${MINGW_PACKAGE_PREFIX}-cc")
source=("https://github.com/ninja-build/ninja/archive/v${pkgver}/${_realname}-${pkgver}.tar.gz")
sha256sums=('821bdff48a3f683bc4bb3b6f0b5fe7b2d647cf65d52aeb63328c91a6c6df285a')

build() {
  mkdir -p "${pkgdir}${MINGW_PREFIX}"/bin
  cd "${srcdir}"/ninja-${pkgver}
  ${MINGW_PREFIX}/bin/python3 configure.py --bootstrap --platform mingw
}

package() {
  mkdir -p "${pkgdir}${MINGW_PREFIX}"/bin
  mv "${srcdir}/ninja-${pkgver}/ninja.exe" "${pkgdir}${MINGW_PREFIX}"/bin/
  mkdir -p "${pkgdir}${MINGW_PREFIX}"/lib
  mv "${srcdir}/ninja-${pkgver}/build/libninja.a" "${pkgdir}${MINGW_PREFIX}"/lib/
}
